Expression Builder HTC - Demo Page

The Expression Builder lets users manipulate and save targeting expressions. These expressions are represented in XML, and are stored in the BizData Store. The Expression Builder widget uses the Query Builder widget to let users manipulate the expression body.

This page demonstrates the basic functionality of the Expression Builder. It also contains a basic description of the Expression Builder's programmatic interface.


Demo

Loading the Expression Builder...


Hint: Try typing in a string for an expr ID to see if EB gets confused.

  /retailbizdesk/exprarch


events

onReady
Indicates that the Expression Builder is fully loaded and initialized, and that its programmatic interface is ready to use. Any app that intends to interact with the Expression Builder's programmatic interface should ensure that they do this AFTER this event fires.

event object properties

none

onComplete
This event fires when the Expression Builder has been successfully terminated, either by the user pressing "Save" or "Cancel" buttons, and no errors taking place in the save/cancel operations.

event object properties

none

onError
This event fires when activation of the Expression Builder fails at any point. Keep in mind that the Activate method may return a success value, but an onError event later fires as well because some unexpected error takes place as activation continues. No error message is returned with the event, but if the Expression Builder is in debug mode, an error is displayed to the user before the event fires.

event object properties

none

methods

bSuccess = divExprBldr.Activate(sMode, nExprID)
Activates the Expression Builder. The arguments specify the ID of the expression to load, and the mode of operation to load it in as. The arguments must be the following:

parameters

sMode (Required) String. See table below.

nExprID (Required) Integer. See table below.

sMode nExprID
"create" any number; nExprID is ignored
"createfrom" the ID of a valid expression in the store
"edit" the ID of a valid expression in the store
"view" the ID of a valid expression in the store

return value

bSuccess Boolean. If a fatal error occurs during this function's operation, returns false. Otherwise it returns true.

divExprBldr.Deactivate()
Deactivates the Expression Builder and disables all controls.

parameters

none

return value

none

dictResults = divExprBldr.GetResults()
Returns the current Expression Builder status / results.

parameters

none

return value

dictResults Scripting.Dictionary. The following values are present on this object:
Key (string) Value
'SavedExpr' This value is true if the current expression has been successfully saved (i.e. a successful "create" or "save" operation), or false if the current expression has not been saved.
'ExprID' ID of the expression that was created/edited/viewed. If a new expression is being created and it hasn't been saved yet, this will be -1 (EXPRID_INVALID).
'ExprName' Current name of the expression. If the user is still performing edits when the GetResults() method is called, the current value of the expression name is returned, not the previous name.
'ExprBody' XML of the expression body. If the user is still performing edits when the GetResults() method is called, the current value of the expression body XML is returned, not the previous expression body XML.

divExprBldr.Save()
Saves the current expression changes, if the Expression Builder is in the appropriate mode.

parameters

none

return value

none

remarks

This method is identical to having the user actually push the "Save" button; it simply provides a programmatic way of saving the expression. Thus, it will fire an onComplete event if the save operation succeeds.

divExprBldr.Cancel()
Cancels editing.

parameters

none

return value

none

remarks

This method is identical to having the user actually push the "Cancel" button; it simply provides a programmatic way of cancelling. Thus, it will fire an onComplete event if the save operation succeeds. Also, if changes have been made to the profile, the user will be notified that changes will be lost.

container attributes (set on element)

XMLConfigID ID of an XML data-island from which the Expression Builder can load its configuration information.

scriptable properties

bReady = divExprBldr.IsReady
Indicates whether the Expression Builder is ready or not. This property is false before the onReady event fires, and is true after the onReady event fires. It is provided so that external components can determine if the Expression Builder is ready to be used without using events.
bActive = divExprBldr.IsActive
Indicates whether the Expression Builder is currently active or not. This property is true when the Expression Builder is active (ie. the user can interact with the Expression Builder) and false when it is inactive.

Configuration XML

KEY:     <NodeTag>     <RepeatingNodeTag*>     @attribute

sample

<XML ID="xmlisConfig">
  <EBCONFIG>
    <DEBUG />
    <EXPR-ASP>/retailbizdesk/exprarch</EXPR-ASP>
    <SITE-TERMS URL='SiteTerms.xml' />
    <PROFILE-LIST>
      <PROFILE SRC="NonUPMProfDefs.asp" />
      <PROFILE>Profile Definitions.UserObject</PROFILE>
    </PROFILE-LIST>
    <EEE-INTRINSICS />
    <ADVANCED />
  </EBCONFIG>
</XML>